$(function () {
    //======================
    //======设置查询条件========
    //======================

    //搜索按钮
    $("#fkbb_toolbar [name='searchButton']").click(function () {
        $(grid).datagrid({
            queryParams:{
                enddt:$("#fkbb_toolbar [name='fkbb_endDate']").val()
            }});
    });


//======================
//========统计列表========
//======================
    var columns = [
        [
            {field:'CK_MC', title:'存货仓库', width:145, align:'center'},
            {field:'KH_QC', title:'客户', width:345, align:'center'},
            {field:'WZLB_NAME', title:'物资类别', width:145, align:'center'},
            {field:'GG_NAME', title:'品名', width:145, align:'center'},
            {field:'CD_Z', title:'产地', width:145, align:'center'},
            {field:'GG_CZ', title:'材质', width:145, align:'center'},
            {field:'GG_GGXH', title:'规格', width:145, align:'center'},
            {field:'KY_JS', title:'可用件', width:145, formatter:function (v, r, i) {
                return formatMoneyFourWei(v);
            }, align:'right'},
            {field:'KY_SL', title:'可用量', width:145, formatter:function (v, r, i) {
                return formatMoneyFourWei(v);
            }, align:'right'},
            {field:'HT_JS', title:'合同件', width:145, formatter:function (v, r, i) {
                return formatMoneyFourWei(v);
            }, align:'right'},
            {field:'HT_SL', title:'合同量', width:145, formatter:function (v, r, i) {
                return formatMoneyFourWei(v);
            }, align:'right'},
            {field:'WCK_JS', title:'提单未提件', width:145, formatter:function (v, r, i) {
                return formatMoneyFourWei(v);
            }, align:'right'},
            {field:'WCK_SL', title:'提单未提量', align:'right', formatter:function (v, r, i) {
                return formatMoneyFourWei(v);
            }, width:145},
            {field:'KGD_JS', title:'可挂牌件', width:145, formatter:function (v, r, i) {
                return formatMoneyFourWei(v);
            }, align:'right'},
            {field:'KGD_SL', title:'可挂牌量', align:'right', formatter:function (v, r, i) {
                return formatMoneyFourWei(v);
            }, width:145},
            {field:'GD_JS', title:'挂牌件', width:145, formatter:function (v, r, i) {
                return formatMoneyFourWei(v);
            }, align:'right'},
            {field:'GD_SL', title:'挂牌量', align:'right', formatter:function (v, r, i) {
                return formatMoneyFourWei(v);
            }, width:145}
        ]
    ];

    var grid = $('#fkbb_grid').datagrid({
        url:$.webPath() + '/tjbb/fkbb/fkbblist',
        toolbar:"#fkbb_toolbar",
        // pagination: true,
        rownumbers:true,
        singleSelect:true,
        collapsible:true,
        fit:true,
        fitColumns:true,
        pageNumber:1,
        showFooter:true,
        /*queryParams: {
         date: $("#fkbb_toolbar [name='fkbb_endDate']").val()
         },*/
        onLoadSuccess:function () {
            $(".datagrid-htable .datagrid-cell").css('text-align', 'center');
        },
        columns:columns
    });
});
